var htmlWP = require('html-webpack-plugin');
module.exports = {
    entry:'./src/main.js',//指定打包入口
    output:{
        path:__dirname + '/dist',
        filename:'build.js'
    },
    module:{
        loaders:[
            {
                test:/\.css$/,
                loader:'style-loader!css-loader'
            },
            {
                test:/\.scss$/,
                loader:'style-loader!css-loader!sass-loader'
            },
            {   
                test:/\.(jpg|png|ttf|svg|gif)$/,
                loader:'url-loader?limit=20000'//limit表示图片大小20K为临界值，小于20k打包到gub.js中
            }
            ,{
                test:/\.js$/,
                loader:'babel-loader',
                exclude:/node_modules/
            }
            ,{
                test:/\.vue$/,
                loader:'vue-loader'
            },
            {
                test: /vue-preview.src.*?js$/,
                loader: 'babel-loader'
            }

        ]
    },
    //webpack2.0支持es6转es5所以可以删除
    // babel:{
    //     presets:['es2015'],//配置将es6语法转换成es5
    //     plugins:['transform-runtime']
    // },
    plugins:[
            new htmlWP({
                title:'首页',
                filename:'index.html',
                template:'index1.html'
            })
        ]
}